﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace bll
{
    /// <summary>
    /// clsProject: Klasse für Projekte von TimeIt
    /// nur Attribute, keine Methoden
    /// </summary>
    public class clsProject
    {
        // private Attribute
        private int _id;
        private string _name;
        private string _client;
        private int _contractPrice;
        private int _externalHourlyRate;
        private bool _active;
        private double _db;
        private int _controlInternalHourlyRate;
        private double _internalCosts;
        private double _externalCosts;
        private string _contactPerson;
        private string _address;
        private string _postcode;
        private string _location;
        private string _country;
        private string _telNr;
        private DateTime _date;
        private int _hours;
        private string _description;
        private int _costs;
        private static int _allCosts = 0;
        private static int _allCosts2 = 0;
        private string _category;

        // Constructor (leer)
        public clsProject() { }

        // properties
        /// <summary>
        /// ID von Projekt
        /// </summary>
        public int ID
        {
            get { return _id; }
            set { _id = value; }
            // ID darf eigentlich nicht verändert werden, da der Wert von der DB vergeben wird und nicht verändert werden kann
            // Gridview braucht aus irgendeinem Grund jedoch die set-Methode
        }

        /// <summary>
        /// Name von Projekt
        /// </summary>
        public String Name
        {
            get { return _name; }
            set
            {
                if (value != "")
                    _name = value;
                else
                    _name = "No Name";
            }
        }

        /// <summary>
        /// Client von Projekt (Auftraggeber) 
        /// </summary>
        public String Client
        {
            get { return _client; }
            set
            {
                if (value != "")
                    _client = value;
                else
                    _client = "no Client";
            }
        }
        
        /// <summary>
        /// Vereinbarter Preis für das Projekt
        /// </summary>
        public int ContractPrice
        {
            get { return _contractPrice; }
            set
            {
                if (value <= 1)
                    _contractPrice = 1;
                else
                    _contractPrice = value;
            }
        }

        /// <summary>
        /// externer Stundensatz (für externe Kostenrechnung)
        /// (muss mindestens 1 sein)
        /// </summary>
        public int ExternalHourlyRate
        {
            get { return _externalHourlyRate; }
            set
            {
                if (value <= 1)
                    _externalHourlyRate = 1;
                else
                    _externalHourlyRate = value;
            }
        }

        /// <summary>
        /// externer Stundensatz (für externe Kostenrechnung)
        /// (muss mindestens 1 sein)
        /// </summary>
        public bool Active
        {
            get { return _active; }
            set { _active = value; }
        }

        /// <summary>
        ///Deckungsbeitrag
        /// </summary>
        public double Db
        {
            get { return _db; }
            set {_db = value; }
        }

        /// <summary>
        ///Interner Stundensatz für Controlling
        /// </summary>
        public int InternalHourlyRate
        {
            get { return _controlInternalHourlyRate; }
            set { _controlInternalHourlyRate = value; }
        }

        /// <summary>
        ///Interne Kosten für Controlling
        /// </summary>
        public double InternalCosts
        {
            get { return _internalCosts; }
            set { _internalCosts = value; }
        }

        /// <summary>
        ///Externe Kosten für Controlling
        /// </summary>
        public double ExternalCosts
        {
            get { return _externalCosts; }
            set { _externalCosts = value; }
        }


        /// <summary>
        /// Die Adresse
        /// </summary>
        public String Address
        {
            get { return _address; }
            set
            {
                if (value != "")
                    _address = value;
                else
                    _address = "No Address";
            }
        }

        /// <summary>
        /// Die Postleitzahl
        /// </summary>
        public String Postcode
        {
            get { return _postcode; }
            set
            {
                if (value != "")
                    _postcode = value;
                else
                    _postcode = "No Postcode";
            }
        }

        /// <summary>
        /// Name von Kontaktperson
        /// </summary>
        public String ContactPerson
        {
            get { return _contactPerson; }
            set
            {
                if (value != "")
                    _contactPerson = value;
                else
                    _contactPerson = "No Contact";
            }
        }

        /// <summary>
        /// Name des Sitzes vom Unternehmen
        /// </summary>
        public String Location
        {
            get { return _location; }
            set
            {
                if (value != "")
                    _location = value;
                else
                    _location = "No Location";
            }
        }

        /// <summary>
        /// Land des Sitzes vom Unternehmen
        /// </summary>
        public String Country
        {
            get { return _country; }
            set
            {
                if (value != "")
                    _country = value;
                else
                    _country = "No Location";
            }
        }

        /// <summary>
        /// Telefonnummer 
        /// </summary>
        public String TelNr
        {
            get { return _telNr; }
            set
            {
                if (value != "")
                    _telNr = value;
                else
                    _telNr = "No Number";
            }
        }

        /// <summary>
        /// Datum der Rechnungsstunden
        /// </summary>
        public DateTime Date
        {
            get { return _date; }
            set { _date = value; }
        }

        /// <summary>
        /// Vereinbarter Preis für das Projekt
        /// </summary>
        public int Hours
        {
            get { return _hours; }
            set { _hours = value; }
        }

        /// <summary>
        /// Description of the work done on the project
        /// </summary>
        public String Description
        {
            get { return _description; }
            set
            {
                if (value != "")
                    _description = value;
                else
                    _description = "No Description";
            }
        }

        /// <summary>
        /// Category of the work which is done for the project 
        /// </summary>
        public String Category
        {
            get { return _category; }
            set
            {
                if (value != "")
                    _category = value;
                else
                    _category = "No Category";
            }
        }

        /// <summary>
        ///Externe (einzelne) Kosten
        /// </summary>
        public int Costs
        {
            get { return _costs; }
            set { _costs = value; }
        }

        /// <summary>
        ///Externe Kosten insgesamt
        /// </summary>
        public static int AllCosts
        {
            get { return _allCosts; }
            set
            {
                _allCosts = value;
            }
        }

        /// <summary>
        ///Externe Kosten 2 insgesamt
        /// </summary>
        public static int AllCosts2
        {
            get { return _allCosts2; }
            set
            {
                _allCosts2 = value;
            }
        }

    } // clsProject
}
